﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Dynamic;

namespace UIT.Web.Controls.Template
{
    public class TemplateSyntaxGenerator : DynamicObject
    {
        public TemplateSyntaxGenerator()
        {
            pathFragments = new List<string>();
        }

        private List<string> pathFragments;

        public override bool TryGetMember(GetMemberBinder binder, out object result)
        {
            result = this;
            pathFragments.Add(binder.Name);
            return true;
        }

        public override string ToString()
        {
            return "${" + string.Join(".", pathFragments) + "}";
        }
    }
}
